package srdb.migration.common;

public abstract class MTKConstants {
	public static char CONST_PRIMARY = 'P';
	public static char CONST_FOREIGN = 'R';
	public static char CONST_UNIQUE = 'U';
	public static char CONST_CHECK = 'C';
	public static final int ORA_IDENTIFER_LENGTH = 30;

	public static String translateDeleteRule(short rule) {
		switch (rule) {
		case 3:
			return "NO ACTION";
		case 0:
			return "CASCADE";
		case 2:
			return "SET NULL";
		case 1:
			return "RESTRICT";
		case 4:
			return "SET DEFAULT";
		}
		return "";
	}

	public static enum TABLE_CONSTRAINT_TYPE {
		PRIMARY_KEY, CHECK, UNIQUE, FOREIGN_KEY;

		public String getString() {
			switch (MTKConstants.TABLE_CONSTRAINT_TYPE.values()[ordinal()]) {
			case PRIMARY_KEY:
				return "Primary Key";
			case CHECK:
				return "Check";
			case UNIQUE:
				return "Unique";
			case FOREIGN_KEY:
				return "Foreign Key";
			}

			throw new AssertionError("Unknown option: " + this);
		}
	}

	public static enum ObjectTypes {
		TABLE, PROCEDURE, FUNCTION, TRIGGER, CONSTRAINT, SCHEMA, INDEX, VIEW, SYNONYM, SEQUENCE, PACKAGE, DBLINK, ROLE, USER, GRANT, OBJECTTYPE, RULE, GROUP, DOMAIN, DATATYPE;

		public String toString() {
			String value = "";
			switch (ObjectTypes.values()[ordinal()]) {
			case TABLE:
				value = "table";
				break;
			case CONSTRAINT:
				value = "constraint";
				break;
			case INDEX:
				value = "index";
				break;
			case FUNCTION:
				value = "function";
				break;
			case PACKAGE:
				value = "package";
				break;
			case PROCEDURE:
				value = "procedure";
				break;
			case SEQUENCE:
				value = "sequence";
				break;
			case SYNONYM:
				value = "synonym";
				break;
			case TRIGGER:
				value = "trigger";
				break;
			case SCHEMA:
				value = "schema";
				break;
			case VIEW:
				value = "view";
				break;
			case DBLINK:
				value = "dblink";
				break;
			case ROLE:
			case USER:
				value = "user";
				break;
			case GRANT:
				value = "grant";
				break;
			case OBJECTTYPE:
				value = "objecttype";
				break;
			case RULE:
				value = "rule";
				break;
			case GROUP:
				value = "group";
				break;
			case DOMAIN:
				value = "domain";
				break;
			case DATATYPE:
				value = "type";
			}

			return value;
		}
	}

	public static enum TablePartitionType {
		HASH, RANGE, LIST;

		public String getString() {
			switch (MTKConstants.TablePartitionType.values()[ordinal()]) {
			case HASH:
				return "Hash";
			case RANGE:
				return "Range";
			case LIST:
				return "List";
			}

			throw new AssertionError("Unknown option: " + this);
		}
	}

	public static enum DATABASE_TYPE {
		ENTERPRISEDB, ORACLE, MYSQL, SQLSERVER, SYBASE,
		// POSTGRESQL,
		DB2, SRDB, NPS, OFFLINE;

		public String getString() {
			switch (MTKConstants.DATABASE_TYPE.values()[ordinal()]) {
			case ENTERPRISEDB:
				return "EnterpriseDB";
			case ORACLE:
				return "Oracle";
			case MYSQL:
				return "MySQL";
			case SQLSERVER:
				return "SQL Server";
			case SYBASE:
				return "Sybase";
				// case POSTGRESQL:
				// return "Postgres";
			case SRDB:

				return "Srdb";
			case DB2:
				return "DB2";
			case NPS:
				return "NPS";
			case OFFLINE:
				return "Offline";
			}

			throw new AssertionError("Unknown option: " + this);
		}
	}
}

/*

 */